<template>
  <div class="login-wrap">
      <el-form class="login-container">
        <h1 class="title">打分</h1>
        <el-form-item >
          <el-input type="text" v-model="name"  placeholder="请输入裁判姓名" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item >
          <el-input type="text" v-model="idCard" placeholder="请输入身份证号" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="doLogin" style="width: 100%;">登陆</el-button>
        </el-form-item>
      </el-form>
  </div>
</template>
 
<script>
export default{
  name:'Login',
  data(){
    return {
      name:'',
      idCard:''
    }
  },
  methods:{
    doLogin(){
      // if(this.radio === 3) {
      //   this.$router.push({ path: this.redirect || "/score/normalreferee" }).catch(()=>{});
      // } else if(this.radio === 2) {
      //   this.$router.push({ path: this.redirect || "/score/headreferee" }).catch(()=>{});
      // } else {
      //   this.$router.push({ path: this.redirect || "/score/controller" }).catch(()=>{});
      // }
      let name=this.name;
      let idCard=this.idCard;
      let params = {
        name:name,
        idCard:idCard
      }
      this.$store.dispatch("LoginScore", params).then(() => {
        this.$store.dispatch('GetRefereeInfo').then(res => {
          if(res.type === '裁判长') {
            this.$router.push({ path: this.redirect || "/score/headreferee" }).catch(()=>{});
          } else {
            this.$router.push({ path: this.redirect || "/score/normalreferee" }).catch(()=>{});
          }
        })
        // this.$router.push({ path: this.redirect || "/user" }).catch(()=>{});
      }).catch(() => {
        this.loading = false;
        // if (this.captchaEnabled) {
        //   this.getCode();
        // }
      });
      // let username=this.username;
      // let password=this.password;
      // let params = {
      //   username:username,
      //   password:password
      // }
      // this.$store.dispatch("Login", params).then(() => {
      //   this.$router.push({ path: this.redirect || "/user" }).catch(()=>{});
      // }).catch(() => {
      //   this.loading = false;
      // });
    }
  }
}
</script>
 
<style>
  	.login-wrap {
  		box-sizing: border-box;
  		width: 100%;
  		height: 100%;
  		padding-top: 10%;
  		/* background-color: #112346; */
  		background-repeat: no-repeat;
  		background-position: center right;
  		background-size: 100%;
  	}
 
  	.login-container {
  		border-radius: 10px;
  		margin: 0px auto;
  		width: 300px;
  		padding: 30px 35px 15px 35px;
  		background: #fff;
  		border: 1px solid #eaeaea;
  		text-align: left;
  		box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.1);
  	}
 
  	.title {
  		margin: 0px auto 20px auto;
  		text-align: center;
  		color: #505458;
  	}
</style>